//package com.conf.mongodb;
//import com.mongodb.DB;
//import com.mongodb.MongoClient;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.dao.DataAccessException;
//import org.springframework.data.mongodb.MongoDbFactory;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
//
//@Configuration
//public class MongodbConfig {
//    @Value("${spring.data.mongodb.port}")
//    private int port;
//    @Value("${spring.data.mongodb.uri}")
//    private String url;
//    @Value("${spring.data.mongodb.host}")
//    private String host;
//    @Value("${spring.data.mongodb.database}")
//    private String database;
//    @Bean
//    public MongoClient mongoClient() throws Exception{
//        MongoClient mongoClient = new MongoClient(this.host,this.port);
//        return mongoClient;
//    }
//    @Bean
//    public MongoDbFactory mongoDbFactory(MongoClient mongoClient){
//        SimpleMongoDbFactory factory = new SimpleMongoDbFactory(mongoClient,this.database);
//        return factory;
//    }
//    @Bean
//    public MongoTemplate mongoTemplate(MongoDbFactory factory){
//        MongoTemplate mongoTemplate = new MongoTemplate(factory);
//
//        return mongoTemplate;
//    }
//
//}
